<template>
  <div class="event-detail">
    <Header />
    <div class="page-header">
      <h1>{{ event.title }}</h1>
      <p>活动详情</p>
    </div>
    
    <div class="detail-container" v-if="event">
      <div class="event-header">
        <h2>{{ event.title }}</h2>
        <div class="event-meta">
          <span class="event-date"><i class="el-icon-date"></i> {{ event.startDate }}</span>
          <span class="event-location"><i class="el-icon-map-marker"></i> {{ event.location }}</span>
        </div>
      </div>
      
      <div class="event-content">
        <div class="event-image">
          <img :src="event.image" alt="活动图片">
        </div>
        <div class="event-info">
          <h3>活动简介</h3>
          <p>{{ event.description }}</p>
          
          <h3>活动详情</h3>
		  <p>{{event.content}}</p>

          
          <h3>活动日程</h3>
          <el-timeline>
            <el-timeline-item
              v-for="(schedule, id) in event.schedules || []"
              :key="id"
              :timestamp="schedule.stratTime"
            >
              <div class="schedule-item">
                <h4>{{ schedule.title }}</h4>
                <p>{{ schedule.description }}</p>
              </div>
            </el-timeline-item>
          </el-timeline>
          
          <h3>参与方式</h3>
          <p>{{ event.participation || '请关注官方通知获取参与方式' }}</p>
        </div>
      </div>
      
      <div class="event-footer">
        <el-button type="primary" @click="goBack">返回活动列表</el-button>
      </div>
    </div>
    
    <div class="loading" v-else>
      <el-skeleton :rows="10" active />
    </div>
  </div>
</template>

<script>
import Header from '@/components/Header.vue'


export default {
  name: 'EventDetail',
  components: { Header },
  props: {
    id: {
      type: String,
      required: true
    }
  },
  data() {
    return {
      event: [],
      loading: true
    }
  },
  computed: {
    eventId() {
      return this.id
    }
  },
  mounted() {
	  this.$http.get("userApi/eventCtl/findById?id="+this.id).then((resp) => {
	  	if (resp.data.code == 200) {
	  		this.event = resp.data.data;
	  	}
	  })
	  
  },
  methods: {
    goBack() {
      this.$router.push('/events')
    }
  }
}
</script>

<style scoped>
.event-detail {
  padding-top: 100px;
  background-color: #f9fafc;
}
.page-header {
  max-width: 1200px;
  margin: 0 auto 30px;
  text-align: center;
  padding: 20px 0;
}
.page-header h1 {
  font-size: 28px;
  color: #303133;
  margin-bottom: 10px;
  font-weight: 600;
}
.page-header p {
  font-size: 16px;
  color: #606266;
  margin: 0;
}
.detail-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px 50px;
  background-color: #fff;
  border-radius: 8px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.05);
}
.event-header {
  padding: 30px 0;
  border-bottom: 1px solid #ebeef5;
  margin-bottom: 30px;
}
.event-header h2 {
  font-size: 24px;
  color: #303133;
  margin-bottom: 15px;
}
.event-meta {
  display: flex;
  gap: 20px;
  font-size: 14px;
  color: #606266;
}
.event-content {
  display: flex;
  flex-wrap: wrap;
  gap: 30px;
  margin-bottom: 40px;
}
.event-image {
  flex: 1 1 400px;
  border-radius: 6px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}
.event-image img {
  width: 100%;
  height: auto;
  display: block;
}
.event-info {
  flex: 1 1 calc(100% - 400px);
  min-width: 300px;
}
.highlights {
  padding-left: 20px;
  margin: 15px 0;
}
.highlights li {
  margin-bottom: 10px;
  color: #303133;
}
.schedule-item {
  padding: 15px;
  background-color: #f8f9fa;
  border-radius: 4px;
}
.schedule-item h4 {
  margin-top: 0;
  color: #409EFF;
}
.event-footer {
  display: flex;
  gap: 15px;
  justify-content: flex-end;
  padding-top: 20px;
  border-top: 1px solid #ebeef5;
}
.loading {
  max-width: 1200px;
  margin: 0 auto 50px;
  padding: 0 20px;
}

/* 响应式设计 */
@media (max-width: 768px) {
  .event-content {
    flex-direction: column;
  }
  .event-image, .event-info {
    flex: 1 1 100%;
  }
  .event-footer {
    flex-direction: column;
    gap: 10px;
    align-items: flex-start;
  }
}
</style>